package ru.isys.yoomee.ui;

import java.util.ArrayList;

import ru.isys.yoomee.model.Chat;
import ru.isys.yoomee.model.Yoo;
import android.app.ActivityGroup;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;

public class VenuesTabActivity extends ActivityGroup
{
    public static VenuesTabActivity group;
    private ArrayList<View> mHistory;
    public void onCreate(Bundle savedInstanceState)
    {
        super.onCreate(savedInstanceState);
        group=this;
        mHistory=new ArrayList<View>();        
        Intent venuesAllIntent = new Intent(this, VenuesActivity.class);        
        this.replaceContentView("VenuesActivity", venuesAllIntent);
    }

    public void replaceContentView(String id, Intent newIntent)
    {
        View view = getLocalActivityManager().startActivity(id, newIntent).getDecorView();
        mHistory.add(view);
        this.setContentView(view);
    }

    public void back() {  
        if(mHistory.size() > 0) {  
            mHistory.remove(mHistory.size()-1);
            if(mHistory.size()<=0){
                finish();
            }else{
                setContentView(mHistory.get(mHistory.size()-1));
            }
        }else {  
            finish();  
        }  
    }
    
        
    @Override  
    public void onBackPressed() {  
        VenuesTabActivity.group.back();
    }

}
